/*
	Author: Superxpdude
	
	Description:
	Server-side portion of the authorisation function.
	
	Parameters:
	_this select 0: UID of Player requesting authorisation
	_this select 1: Unit of Player requesting authorisation
	_this select 2 (Optional): Type of request in string (default: basic yes/no response)
	
	Returns:
	Array: Contains the response to be sent back to the client.
*/
private ["_playerUID","_player","_accepted","_request","_error","_response"];

// Grab variables from the auth request
_playerUID = _this select 0;
_player = _this select 1;
_request = _this select 2;

// Define additional variables to use
_accepted = false;
_error = false;

// Check the if the playerUIDs match
If ((getPlayerUID _player) == _playerUID) then {
	// Perform the auth check
	If (_playerUID in master_admins_list) then {
		// If the auth check passes, process the request
		switch _request do {
			case "zeus": {
				unAssignCurator zeus_Admin;
				_player assignCurator zeus_Admin;
				diag_log format ["SXP AUTH SYSTEM: %1 (%2) has logged into the zeus module.",(name _player), _playerUID];
				_accepted = true;
			};
			default {
				_accepted = true;
			};
		};
	};
} else {
	_error = true;
	diag_log format ["SXP AUTH SYSTEM: Client playerUID (%1) failed to match calculated playerUID (%2).", _playerUID, (getPlayerUID _player)];
};

// Send our response back to the script
[_playerUID, _player, _accepted, _error]